<?php

use think\facade\Route;
use app\api\controller\Index;
use app\api\middleware\Auth;
use app\api\controller\User;
use app\api\controller\Collect;
// 默认首页
Route::get('/', 'index/index');

// 图片搜索相关接口
Route::group(function () {
    // 以图搜索产品 'index/searchProductByImage'
    Route::post('search/product', [Index::class, 'searchProductByImage'])->middleware(Auth::class); #以图搜图
    Route::get('product/details', [Index::class, 'ProductDetails'])->middleware(Auth::class);#查询产品具体数据
    Route::post('product/group', [Index::class, 'Productgroup'])->middleware(Auth::class);#获取产品组列表数据（以图搜图返回产品组数据）
    Route::post('upload/image', [Index::class, 'uploadImage'])->middleware(Auth::class);
    // 设备ID登录
    Route::post('user/login', [User::class, 'deviceIdLogin']);// 设备ID登录
    Route::get('user/info', [User::class, 'info'])->middleware(Auth::class);// 用户信息
    Route::post('pad/message_board', [Index::class, 'messageBoard'])->middleware(Auth::class);// 吐槽——留言板
    Route::get('pad/video_desc', [Index::class, 'videoDesc']);// 说明
    // 收藏相关路由
    Route::post('collect/toggle', [Collect::class, 'toggle'])->middleware(Auth::class);//添加/取消收藏
    Route::get('collect/list', [Collect::class, 'list'])->middleware(Auth::class);//获取收藏列表
    Route::get('collect/check', [Collect::class, 'check'])->middleware(Auth::class);//检查是否收藏
    Route::post('collect/delete', [Collect::class, 'delete'])->middleware(Auth::class);//删除收藏
})->prefix('api/'); 
//)->middleware(['auth', 'log']);

